package cn.echoparrot.domain;

import org.neo4j.driver.Driver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.data.neo4j.core.transaction.Neo4jTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 事务管理器配置
 *
 * @author Joey
 */
@Configuration
@EnableTransactionManagement
public class EchoConfig {

    /**
     *
     * 返回类型设置为 Neo4jTransactionManager，是否更好，它只适用于Neo4j也不适用于Mysql
     */
    @Bean("neo4jTransactionManager")
    public PlatformTransactionManager neo4jTransactionManager(Driver neo4jDatabase) {
        return new Neo4jTransactionManager(neo4jDatabase);
    }
}